import java.util.Scanner;

public class chapter08 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("请输入一个数：");
        int num = input.nextInt();
        int sum = 0;
        for(;num>0;num/=10){
            sum=sum+num%10;

        }
        System.out.println(sum);
    }
}
